﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<MethodCategoryInfo>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Method Category - Open API Control Panel
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <fieldset>
        <legend>Method Manage &gt; Category &gt; Modify Category</legend>
        <table border="0" cellspacing="0" width="100%">
            <tr>
                <td width="160">
                    Category Code<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtCATEGORY_CD", Model.CATEGORY_CD, new { @style = "width:250px"})%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Category Name<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtCATEGORY_NAME", Model.CATEGORY_NAME, new { @style = "width:250px"})%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Category Desc
                </td>
                <td>
                    <% =Html.TextArea("txtCATEGORY_DESC", Model.CATEGORY_DESC, new { @style = "width:250px",@rows="4" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    Category Display Order<font color="red">*</font>
                </td>
                <td>
                    <% =Html.TextBox("txtCATEGORY_ORDER", Model.CATEGORY_ORDER, new { @style = "width:80px" })%>
                </td>
            </tr>
            <tr>
                <td width="160">
                    &nbsp;
                </td>
                <td>
                    <input type="button" id="btnMethodCategoryMod" name="btnMethodCategoryMod" value="Modify Category" />
                    <input type="button" id="btnBackToList" name="btnBackToList" value="Back To List" />
                </td>
            </tr>
        </table>
    </fieldset>

    <script type="text/javascript" language="javascript">

        //json: Submit Register
        $().ready(function() {
            $("#btnMethodCategoryMod").click(function() {

                if (confirm('Are you sure submit?')) {

                    var category_cd = $("input[name='txtCATEGORY_CD']").val();
                    var category_name = $("input[name='txtCATEGORY_NAME']").val();
                    var category_desc = $("#txtCATEGORY_DESC").val();
                    var category_order = $("input[name='txtCATEGORY_ORDER']").val();

                    $("input[name='btnMethodCategoryMod']")[0].disabled = "disabled";
                    $("input[name='btnMethodCategoryMod']")[0].value = "Modify Category...";

                    $.post("/Method/AjaxCategoryMod?" + new Date(), {
                        Action: "post",
                        category_cd: category_cd,
                        category_name: category_name,
                        category_desc: category_desc,
                        category_order: category_order
                    }, function(result) {
                        if (result.FLAG) {
                            alert(result.DESC);
                            $("input[name='btnMethodCategoryMod']")[0].disabled = "";
                            $("input[name='btnMethodCategoryMod']")[0].value = "Modify Category";
                        }
                        else {
                            alert(result.DESC);
                            $("input[name='btnMethodCategoryMod']")[0].disabled = "";
                            $("input[name='btnMethodCategoryMod']")[0].value = "Modify Category";
                        }
                    })
                }
            })
        })
        
        $().ready(function() {
            $("#btnBackToList").click(function() {
                location.href = "/Method/CategoryList";
            })
        })

    </script>
</asp:Content>
